package hu.blok1.veilingsite.shared;

import java.util.Date;

import com.google.gwt.user.client.rpc.IsSerializable;

public class User implements IsSerializable{
	private int id;
	private String naam;
	private String lastnaam;
	private String email;
	private String password;
	private Date registerdate;
	private String userType;
	private String bankaccount;
	private int credits;
	private String status;
	private int address_id;
	private Address address;
	
	private boolean isLoggedIn = false;
	
	public User(){
		status = "none";
	}
	
	public User(int _id, String _voornaam, String _achternaam, String _email, String _wachtwoord, Date _registratieDatum, String _typeUser, String _bankrekening, int _credits, String _status, int _address_id){
		id = _id;
		naam = _voornaam;
		lastnaam = _achternaam;
		email = _email;
		password = _wachtwoord;
		registerdate = _registratieDatum;
		userType = _typeUser;
		bankaccount = _bankrekening;
		credits = _credits;
		status = _status;
		address_id = _address_id;
		setLoggedIn();
	}
	
	// GETTERS
	public int getId(){
		return id;
	}
	
	public String getName(){
		return naam;
	}
	
	public String getLastName(){
		return lastnaam;
	}
	
	public String getEmail(){
		return email;
	}
	
	public String getPassword(){
		return password;
	}
	
	public Date getRegisterDate(){
		return registerdate;
	}
	
	public String getUserType(){
		return userType;
	}
	
	public String getBankAccount(){
		return bankaccount;
	}
	
	public int getCredits(){
		return credits;
	}
	
	public String getStatus(){
		return status;
	}
	
	public int getAddressId(){
		return address_id;
	}
	
	public Address getAddress(){
		return address;
	}
	
	// SETTERS
	public void setId(int _id){
		id = _id;
	}
	
	public void setName(String _voornaam){
		naam = _voornaam;
	}
	
	public void setLastName(String _achternaam){
		lastnaam = _achternaam;
	}
	
	public void setEmail(String _email){
		email = _email;
	}
	
	public void setPassword(String _wachtwoord){
		password = _wachtwoord;
	}
	
	public void setRegisterDate(Date _registratieDatum){
		registerdate = _registratieDatum;
	}
	
	public void setUserType(String _typeUser){
		userType = _typeUser;
	}
	
	public void setBankAccount(String _bankrekening){
		bankaccount = _bankrekening;
	}
	
	public void setCredits(int _credits){
		credits = _credits;
	}
	
	public void setStatus(String _status){
		status = _status;
	}
	
	public void setAddressId(int _address_id){
		address_id = _address_id;
	}
	
	public void setAddress(Address _address){
		address = _address;
	}
	
	// Other functions
	public void setLoggedIn(){
		isLoggedIn = true;
	}
	
	public void setLoggedOut(){
		isLoggedIn = false;
	}
	
	public boolean isLoggedIn(){
		return isLoggedIn;
	}
}
